// JavaScript Document


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
			
//동영상
function aviPlay(src,w,h) {
document.write('<embed src="'+src+'" width='+w+' height='+h+'>')
}			

/*png 투명이미지 처리*/
function setPng24(obj) { 
  obj.width=obj.height=1; 
  obj.className=obj.className.replace(/\bpng24\b/i,''); 
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
  obj.src='';  
  return ''; 
}

/*IE6 Background Flicker 버그 수정*/
(function(){
var m = document.uniqueID
&& document.compatMode
&& !window.XMLHttpRequest
&& document.execCommand;

try{
if(!!m){
m("BackgroundImageCache",false,true)
}
}catch(oh){};
})();
/*IE6 Background Flicker 버그 수정*/

/* 플래시 처리*/

function insertFlash(swf, width, height, bgcolor, id, flashvars, title)
{
	var strFlashTag = new String();

	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
		strFlashTag += 'id="' + id + '" title="' + title + '" width="' + width + '" height="' + height + '">';
		strFlashTag += '<param name="movie" value="' + swf + '"/>';

		if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
		strFlashTag += '<param name="quality" value="best"/>';
		strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';
		strFlashTag += '<param name="menu" value="false"/>';
		strFlashTag += '<param name="salign" value="LT"/>';
		strFlashTag += '<param name="scale" value="noscale"/>';
		strFlashTag += '<param name="wmode" value="transparent"/>';
		strFlashTag += '<param name="allowScriptAccess" value="sameDomain"/>';
		strFlashTag += '</object>';
	}
	else
	{


		strFlashTag += '<embed src="' + swf + '" ';
		strFlashTag += 'quality="best" ';
		strFlashTag += 'bgcolor="' + bgcolor + '" ';
		strFlashTag += 'width="' + width + '" ';
		strFlashTag += 'height="' + height + '" ';
		strFlashTag += 'menu="false" ';
		strFlashTag += 'scale="noscale" ';
		strFlashTag += 'id="' + id + '" ';
		strFlashTag += 'salign="LT" ';
		strFlashTag += 'wmode="transparent" ';
		strFlashTag += 'allowScriptAccess="sameDomain" ';
		if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
		strFlashTag += 'type="application/x-shockwave-flash" ';
		strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
		strFlashTag += '</embed>';
	}

	document.write(strFlashTag);
}

function insertFlash2(swf, width, height, bgcolor, id, flashvars, title,noobj)
{
	var strFlashTag = new String();


	strFlashTag += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="' + id + '" title="' + title + '" width="' + width + '" height="' + height + '" align="middle">';
	strFlashTag += '<param name="movie" value="' + swf + '" />';
	strFlashTag += '<param name="quality" value="best"/>';
	strFlashTag += '<param name="flashvars" value="'+flashvars+'" />';
	strFlashTag += '<param name="allowFullScreen" value="false" />';
	strFlashTag += '<param name="quality" value="high" />';
	strFlashTag += '<param name="wmode" value="transparent" />';
	strFlashTag += '<param name="scale" value="noscale"/>';
	strFlashTag += '<param name="bgcolor" value="#ffffff" />';
	strFlashTag += '<object type="application/x-shockwave-flash" data="' + swf + '" id="' + id + '_noobj" title="' + title + '" width="' + width + '" height="' + height + '">';
	strFlashTag += '<param name="flashvars" value="'+flashvars+'" />';
	strFlashTag += '<param name="quality" value="best"/>';
	strFlashTag += '<param name="menu" value="false"/>';
	strFlashTag += '<param name="salign" value="LT"/>';
	strFlashTag += '<param name="scale" value="noscale"/>';
	strFlashTag += '<param name="wmode" value="transparent"/>';
	strFlashTag += '<param name="allowScriptAccess" value="sameDomain"/>';

	strFlashTag += noobj.innerHTML;
	strFlashTag += '</object>';
	strFlashTag += '</object>';
	 

	document.write(strFlashTag);
}

/* 플래시 처리*/

/* 웹접근성에 이용할 플래시 로더 스크립트*/
function SWFLoader() {
	var obj = new String;
	var parameter = new String;
	var embed = new String;
	
	var classId = new String;
    var codeBase = new String;
	var pluginSpage = new String;
	var embedType = new String;	
	var allParameter = new String;	
	
	var src = new String;
	var width = new String;
	var height = new String;
	var id = new String;
	var title = new String;
	var layer = new String;
	var arg = new String;
	var altText = new String;
	var wmode = new String;

	this.init = function ( w, h, s, a ) {
		width = w; 
		height = h; 
		src = s; 
		arg = a; 
		wmode = 'transparent'; 

		classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
		codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
		pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
		embedType = 'application/x-shockwave-flash';

		parameter += "<param name='allowScriptAccess' value='always'>\n";
		parameter += "<param name='allowFullScreen' value='false'\n>";
		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='best'/>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name='scale' value='noscale'/>\n";
		parameter += "<param name='expressinstall' value='Scripts/expressInstall.swf' />\n";
	}
	
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	this.wmode = function ( value ) {
		wmode = value;
	}

	this.id = function ( value ) {
		id = value;
	}
	this.title = function ( value ) {
		title = value;
	}

	this.shocknone = function ( value ) {
		altText = value;
	}

	this.layer = function ( value ) {
		if(value == undefined) {
			layer = "";
		} else {
			layer = value;
		}
	}

	this.show = function () {
		obj = '<object id="'+id+'" width="'+width+'" height="'+height+'" title="'+title+'" classid="'+classId+'" codebase="'+codeBase+'">\n'+
			parameter +
			'<param name="wmode" value="'+wmode+'">\n'+
			'<!--[if !IE]>-->\n' +
			'<object type="application/x-shockwave-flash" data="' + src + '" width="' + width + '" height="' + height + '" name="' + id + '">\n' +
				parameter +
				'<param name="wmode" value="'+wmode+'">\n'+
			'<!--<![endif]-->\n' +
				'<div class="alt-content alt-' + id + '2">' + altText + '</div>\n' +
			'<!--[if !IE]>-->\n' +
			'</object>\n' +
			'<!--<![endif]-->\n' +
		'</object>';

		if(layer == "") {
			document.write(obj);

		}else{
			var div = document.getElementById( layer);
			div.style.display = "";
			div.innerHTML = obj;
		}
	}
}
/* 웹접근성에 이용할 플래시 로더 스크립트*/


/* font 사이즈  */

var ttsenv_fontRate = 2;
var ttsenv_fontmaxRate = 19;
var ttsenv_fontminRate = 10;
var ttsenv_fontDefault = '';
var ttsenv_mustadjustfont = true;
var ttsenv_fontcolor = new Array();
var tts_curRate;
var tts_fontcolorindex;
var tts_bgcolorindex;
var tts_curfontsize;
var ttsenv_bgcolor = new Array();

ttsenv_fontcolor[0] = "";
ttsenv_fontcolor[1] = "#000000";
ttsenv_fontcolor[2] = "#ffff00";
ttsenv_fontcolor[3] = "#ffffff";
ttsenv_fontcolor[4] = "#6666ff";
ttsenv_fontcolor[5] = "#ff6666";
ttsenv_fontcolor[6] = "#ff66ff";
ttsenv_fontcolor[7] = "#66ff66";

ttsenv_bgcolor[0] = "";
ttsenv_bgcolor[1] = "#ffffff";
ttsenv_bgcolor[2] = "#000000";
ttsenv_bgcolor[3] = "#6666ff";
ttsenv_bgcolor[4] = "#ff6666";
ttsenv_bgcolor[5] = "#ff66ff";
ttsenv_bgcolor[6] = "#66ff66";

function f_scalescreen(mode)
{
   
    if((document.body.style.zoom==null)||(ttsenv_mustadjustfont==true)) {
        
        if(mode==1) {
            if(tts_curfontsize==null) {
                tts_curfontsize=ttsenv_fontminRate;
            } else if(tts_curfontsize=='') {
                tts_curfontsize=ttsenv_fontminRate;
            } else {
                tts_curfontsize=tts_curfontsize-(-ttsenv_fontRate);
                if(tts_curfontsize>ttsenv_fontmaxRate) {
                    tts_curfontsize=ttsenv_fontmaxRate;
                }
            }
        } else if(mode==-1) {
            if(tts_curfontsize!=null) {
                if(tts_curfontsize!='') {
                    tts_curfontsize=tts_curfontsize-ttsenv_fontRate;
                    if(tts_curfontsize<ttsenv_fontminRate) {
                        tts_curfontsize='';
                    }
                }
            }
        } 
        
        webgen_setface();
    } 
}


function f_setBasic()
{        
    tts_curfontsize = '';
//	var objSelectBox = document.getElementById("selectSite");
//    objSelectBox.selectedIndex = 0;	
    webgen_setface();  
}


function webgen_setface()
{
    webgen_setface_run(document.body);
    if(document.getElementById('select')!=null) {
        document.getElementById('select').selectedIndex = parseInt(tts_fontcolorindex);
    }
    if(document.getElementById('select')!=null) {
        document.getElementById('select').selectedIndex = parseInt(tts_bgcolorindex);
    }    
}


function webgen_setface_run(obj) {
    if(obj==null) {
        return;
    }
    if(obj.childNodes!=null) {
        var i;
        var s=false;
        if(obj.style!=null) {
            obj.style.backgroundColor=ttsenv_bgcolor[tts_bgcolorindex];
            obj.style.color=ttsenv_fontcolor[tts_fontcolorindex];
        }
        for(i=0;i<obj.childNodes.length;i++) {
            if(obj.childNodes[i].nodeName=="#text") {
                if(s==false) {
                    if(obj.style!=null) {
                        if((document.body.style.zoom==null)||(ttsenv_mustadjustfont==true)) {
                            if(tts_curfontsize==null) {
                                obj.style.fontSize='';
                            } else if(tts_curfontsize=='') {
                                obj.style.fontSize='';
                            } else {
                                obj.style.fontSize=tts_curfontsize+'pt';
                            }
                        }
                    }
                    s=true;
                }
            } else {
                webgen_setface_run(obj.childNodes[i]);
            }
        }
    }
}



/* font 사이즈  */